package com.hdu.dwh.service.flink_service;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PatchExchange;
import org.springframework.web.service.annotation.PostExchange;

import com.hdu.dwh.dtos.cdc_dtos.MysqlcdcDtos;
import com.hdu.dwh.pojos.FlinkJob;
import com.hdu.dwh.pojos.FlinkJobRequest;

/**
 * FlinkWebRestService
 * flink服务 rest接口
 */
@Service
@HttpExchange(url = "/")
public interface FlinkWebRestService {
    
    @PostExchange(url = "jars/{jarId}/run")
    FlinkJob runJob(@PathVariable String jarId,@RequestBody FlinkJobRequest<?> flinkJobRequest);

    @PostExchange(url = "jars/{jarId}/plan")
    Map<String, Object> planJob(@PathVariable String jarId,@RequestBody FlinkJobRequest<?> flinkJobRequest);

    @PostExchange(url = "jars/{jarId}/run")
    FlinkJob executeSQLJob(@PathVariable String jarId,@RequestBody FlinkJobRequest<String> flinkJobRequest);

    @GetExchange(url = "jobs/overview")
    Object fetchFlinkCurrentJob();

    @GetExchange(url = "jobs/{jobId}")
    Object fetchFlinkJobDetails(@PathVariable String jobId);

    @PatchExchange(url = "jobs/{jobId}")
    Object stopFlinkJob(@PathVariable String jobId);

    @GetExchange(url = "jars", accept = "application/json")
    Map<String, Object> fetchFlinkUploadJars();
    
}
